
#https://blog.csdn.net/sinat_31608641/article/details/121666011
#https://blog.csdn.net/zj1131190425/article/details/125792572

# requirments
cmake_minimum_required(VERSION 3.12.0)

# set compiler
SET(CMAKE_C_COMPILER /usr/bin/gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/g++)

# c++ standard
#set(CMAKE_C_STANDARD 17)
#set(CMAKE_CXX_STANDARD 17)

# set compiler params 
set(CMAKE_C_FLAGES "${CMAKE_CXX_FLAGES}")
set(CMAKE_CXX_FLAGES "${CMAKE_CXX_FLAGES} -std=c++17")

#message("$ENV{CFLAGS}") #C compiler params
#message("$ENV{CXXFLAGS}") #C++ compiler params

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_C_FLAGES_DEBUG "$ENV{CFLAGS}")
set(CMAKE_CXX_FLAGES_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
#set(CMAKE_BUILD_TYPE "release")
set(CMAKE_C_FLAGES_RELEASE "$ENV{CFLAGS}")
set(CMAKE_CXX_FLAGES_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

# project info
project(development-kit)

# set/unset usage
#set(SOURCES
#    MemoryPool/nginx/ngx_mem_pool.cpp
#    main.cpp
#)
# unset(SOURCES)

#---------------produce mem pool-----------------
# aux_source_directory(. DIR_SRCS)
aux_source_directory(MemoryPool/nginx DIR_SRCS)
#message(${DIR_SRCS})

# execute target
add_executable(mem_pool ${DIR_SRCS} )


# include .h files
target_include_directories(
  mem_pool
  PRIVATE ${PROJECT_SOURCE_DIR}/MemoryPool/nginx
)

# add so library
target_link_libraries(mem_pool -pthread)